#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const ll N = 20, INF = 0x3f3f3f3f;

ll a, b;
ll dp[N][N];
ll num[N], tt;

ll dfs(ll pos, ll last, ll _0, ll free)
{
    if (pos == 0) return 1;
    if (dp[pos][last] != -1 && _0 == 0 && free) return dp[pos][last];
    ll ans = 0;
    ll up = free == 1 ? 9 : num[pos];
    for (ll i = 0;i <= up;i++) {
        if (abs(i - last) < 2) continue;
        if (i == 0 && _0) ans += dfs(pos - 1, -2, 1, free || i < up);
        else ans += dfs(pos - 1, i, 0, free == 1 || i < up);
    }
    if (_0 == 0 && free) dp[pos][last] = ans;
    return ans;
}

ll f(ll x)
{
    ll tmp = x;tt = 0;
    while (tmp) {
        num[++tt] = tmp % 10;
        tmp = tmp / 10;
    }
    memset(dp, -1, sizeof dp);
    return dfs(tt, -2, 1, 0);
}

void solve()
{
    cin >> a >> b;
    cout << f(b) - f(a - 1);
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    ll T = 1;
    //cin>>T;
    for (ll i = 1;i <= T;i++) {
        solve();
    }
}